ANTLR_JAR       = addons/antlr.jar
COMMONSLANG_JAR = addons/commons-lang.jar

UMLGRAPH  = java -jar addons/UmlGraph-4.8.jar -hide 'debug|toString'
ANTLR     = java -cp $(ANTLR_JAR) antlr.Tool

all: build_jar translation_tests

clean:
	-@rm -r build

build_jar:
	@mkdir -p build/src build/classes
	@find src -name '*.g' -exec $(ANTLR) -o build/src {} \;
	@javac -cp $(COMMONSLANG_JAR):$(ANTLR_JAR) -source 1.5 -encoding UTF-8 -d build/classes src/*.java build/src/*.java
	@jar cfe build/jsp2php.jar jsp2php.Processor -C build/classes/ .

translation_tests:
	@echo Runing `ls tests/src/*.jsp | wc -l` translation tests: `ls tests/src/*.jsp`
	@mkdir -p build/tests/src
	@time java -cp build/jsp2php.jar:$(ANTLR_JAR) jsp2php.Processor -d build/tests/src tests/src/*.jsp
	@diff -r -x .svn build/tests/src tests/expect && echo 'All test assertions works :-) .'

